#include <bits/stdc++.h>
#define v vector
using namespace std;
int sum;
int arrayPairSum(vector<int> &nums)
{
    sort(nums.begin(), nums.end());
    for (int i = 0; i < nums.size(); i += 2)
    {
        sum += nums[i];
    }
    return sum;
}
int main()
{
    v<int> nums;
    nums.push_back(1);
    nums.push_back(4);
    nums.push_back(3);
    nums.push_back(2);
    cout << arrayPairSum(nums) << endl;
    return 0;
}